home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 5 / MacMania 5.toast / / Tools&Utilities / SortWatch / Read Me next >
Encoding:
Text File  |  1996-08-28  |  3.1 KB  |  47 lines  |  [TEXT/ttxt]

  1. SortWatch 1.0.4 
  2. kirill@lava.net
  3. (August 28, 1:38am)
  4.  
  5. • What is it?
  6. Sort watch is a freeware AfterDark screensaver module that graphically represents an array being sorted using various sorting algorithms. This can be both educational and fun.
  7.  
  8. • What you need
  9. You need AfterDark or DarkSide to use this screen saver module.
  10.  
  11. • What you see happening
  12. On the screen, red dots represent data that is not yet in its sorted position, green dots represent data in its sorted position. A dot’s x-coordinate is its position in the array and the dot’s y-coordinate is its value. The array is filled with values from 0 to N-1 where N is the size of the array and each value occurs only once. An array sorted in ascending order looks like a straight line running from the top left corner to the bottom right corner because for each value X there is an array element A[X] which when sorted contains X.
  13.  
  14. • Fields
  15. Array Size is the size of the array ranging from 5 to 480 elements. The smaller the array, the larger an element’s graphical representation.
  16.  
  17. Sort is the sorting algorithm used.
  18. Random will randomly pick an algorithm from those listed below.
  19. Bubble sort  is the slowest sort, but easiest to understand and usually taught first to CS students.
  20. Shaker sort  is similar to the bubble sort, but the passes are bi-directional.
  21. Insertion sort  is a slower sort. This version uses a linear search.
  22. Heap sort  is a much faster sort. You should be able to see the root node move up from the bottom left corner to the top.
  23. Quicksort  is slightly faster than the heap sort andl ike the heap sort has a magnitude of NlogN.
  24.  
  25. • How they work
  26. Each algorithm is allowed only one swap per cycle after which control returns to AfterDark (or DarkSide). This is not neccessarily the fairest way to judge sorting algorithms, since some will look more than others per each swap. For example the placement sort, which looks for the largest element in the array and then moves it to the front would spend most of it's time looking at the elements of the array,  swap-wise, it's an O(N) algorithm! If it was shown in SortWatch, you would simply see a diagonal line magically form in front of you.
  27.  
  28. Also, keep in mind that just because you know an array is sorted (because it’s all green) doesn’t mean the algorithm does. This is especially true for the bubble sort and shaker sort which are implemented without the “done” flag.
  29.  
  30. • Modifying SortWatch
  31. If you are unahappy with the colors in SortWatch and are confident in your resource editing skills, you can easily chnage the colors used in SortWatch. The background color and the colors of the sorted and unsorted elements are stored in the ‘clut’ resource with id 128.
  32.  
  33. • Version History
  34. Changes since 1.0.3 (May 4, 1996)
  35. Removed the lame sorting algorithms.
  36. Cleaned up resources.
  37. Made colors ResEditable.
  38. Better memory management.
  39. Made some internal changes that have little or no affect on performance.
  40.  
  41. Version 1.0.3 (May 4, 1996)
  42. First version that did not crash at one point or another.
  43.  
  44. • Feedback, etc.
  45. If you have any comments, corrections or questions, I can be found at:
  46. kirill@lava.net
  47. http://www.lava.net/~kirill